package com.facesteel.speech_play.utils;

import android.content.Context;
import java.lang.ref.WeakReference;

public class ContextHelper {

    private ContextHelper() {
    }
    private static final class SingleHolder {
        private static final ContextHelper single = new ContextHelper();
    }

    public static ContextHelper getInstance() {
        return SingleHolder.single;
    }


    private WeakReference<Context> mContext;

    public void setContext(Context context) {
        if (mContext != null) {
            mContext.clear();
            mContext = null;
        }
        mContext = new WeakReference<>(context.getApplicationContext());
    }
    public Context getContext(){
        return mContext.get();
    }
}
